package com.fc.commons.security;

public enum SGlobalUtil {
	INSTANCE;
	
	/**
	 * 
	 * @param source
	 * @return
	 */
    public String bytes2String(byte[] source){
    	StringBuilder builder = new StringBuilder();
    	for(int i=0,j=source.length;i<j;i++){
    		builder.append(byteToArrayString(source[i]));
    	}
    	return builder.toString();
    }
	
    /**
     * 
     * @param bByte
     * @return
     */
    public String byteToArrayString(byte bByte) {
        int iRet = bByte;
        if (iRet < 0) {
            iRet += 256;
        }
        int iD1 = iRet >>> 4;
        int iD2 = iRet % 16;
        return SecurityConst.strDigits[iD1] + SecurityConst.strDigits[iD2];
    }
}
